<template>
  <div>
    <el-table
      :data="cdTableData"
      border
      style="width: 100%">
      <el-table-column
        align="center"
        label="第几次扫码"
        width="106">
        <template slot-scope="scope">
          <label>{{(currentPage-1)*10+scope.$index+1}}</label>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="create_time"
        label="扫码时间"
        min-width="200">
      </el-table-column>
      <el-table-column
        align="center"
        min-width="150"
        label="扫码人员">
          <template slot-scope="scope">
            <label
            v-if="scope.row.type === 1 ">{{scope.row.broker1ScanName}}</label>
            <label
            v-if="scope.row.type === 2 ">{{scope.row.brokerScanName}}</label>
          </template>
      </el-table-column>
      <el-table-column
        prop="type"
        align="center"
        min-width="106"
        label="出库类型">
        <template slot-scope="scope">
          <label
          v-if="scope.row.type === 1 ">入库</label>
          <label
          v-if="scope.row.type === 2 ">出库</label>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        min-width="240"
        label="流通轨迹">
        <template slot-scope="scope">
            <p v-if="scope.row.type === 1"> 商品发往 <span style="color: rgb(49, 97, 255);">【{{scope.row.broker1ScanName}}】</span></p>
            <p v-else-if="scope.row.type === 2">由<span style="color: rgb(49, 97, 255);">【{{scope.row.broker1ScanAddr}}】</span>发往 <span style="color: rgb(49, 97, 255);">【{{scope.row.brokerScanAddr}}】</span></p>
        </template>
      </el-table-column>
    </el-table>
    <div class="pagetbnBox">
      <div  class="lipagination">
        <el-pagination
          background
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="10"
          :pager-count="5"
          layout="total, prev, pager, next"
          :total="total" hide-on-single-page>
          </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'detial',
  props: {
    cdTableData: Array,
    total: ''
  },
  data () {
    return {
      currentPage: null,
      cmdParams: ''
    }
  },
  methods: {
    handleCurrentChange (val) {
      this.currentPage = val
      this.$parent.init(val)
    }
  },
  created () {
    this.currentPage = Number(localStorage.getItem('felingCodeEditCurrentPage')) || 1
  },
  beforeUpdate () {
    localStorage.setItem('felingCodeEditCurrentPage', this.currentPage)
    if (this.$route.params.row) {
      localStorage.setItem('CodetempData', JSON.stringify(this.$route.params))
    }
  },
  mounted () {
    this.$parent.init(this.currentPage)
  }
}
</script>

<style>
</style>
